home *** CD-ROM | disk | FTP | other *** search
/ Champak 130 / Vol 130.iso / games / target_s.swf / scripts / assets / screens / screen_select.as < prev    next >
Encoding:
Text File  |  2008-11-13  |  6.1 KB  |  195 lines

  1. package assets.screens
  2. {
  3.    import flash.display.*;
  4.    import flash.events.*;
  5.    
  6.    [Embed(source="/_assets/assets.swf", symbol="assets.screens.screen_select")]
  7.    public class screen_select extends MovieClip
  8.    {
  9.        
  10.       
  11.       private var scope:Object;
  12.       
  13.       public var character_mc:MovieClip;
  14.       
  15.       public var shirt_mc:MovieClip;
  16.       
  17.       public var course_mc:MovieClip;
  18.       
  19.       public var board_mc:MovieClip;
  20.       
  21.       private var pages:Array;
  22.       
  23.       public function screen_select(param1:*)
  24.       {
  25.          pages = new Array();
  26.          super();
  27.          scope = param1;
  28.          addEventListener(Event.REMOVED_FROM_STAGE,onRemove);
  29.          character_mc.nextCharBtn.addEventListener(MouseEvent.CLICK,nextChar);
  30.          character_mc.selectCharBtn.addEventListener(MouseEvent.CLICK,selectChar);
  31.          shirt_mc.nextShirtBtn.addEventListener(MouseEvent.CLICK,nextShirt);
  32.          shirt_mc.selectShirtBtn.addEventListener(MouseEvent.CLICK,selectShirt);
  33.          board_mc.nextDeckBtn.addEventListener(MouseEvent.CLICK,nextDeck);
  34.          board_mc.nextWheelBtn.addEventListener(MouseEvent.CLICK,nextWheel);
  35.          board_mc.selectBoardBtn.addEventListener(MouseEvent.CLICK,selectBoard);
  36.          course_mc.nextCourseBtn.addEventListener(MouseEvent.CLICK,nextCourse);
  37.          course_mc.selectCourseBtn.addEventListener(MouseEvent.CLICK,selectCourse);
  38.          pages = [character_mc,shirt_mc,board_mc,course_mc];
  39.          character_mc.charbox.gotoAndStop(1);
  40.          shirt_mc.shirtbox.gotoAndStop(1);
  41.          board_mc.boardbox.gotoAndStop(1);
  42.          course_mc.coursebox.gotoAndStop(1);
  43.          course_mc.coursebox.locked_mc.visible = false;
  44.          pageManager(2);
  45.       }
  46.       
  47.       private function locked() : *
  48.       {
  49.          trace("locked");
  50.       }
  51.       
  52.       private function pageManager(param1:*) : *
  53.       {
  54.          var _loc2_:* = undefined;
  55.          _loc2_ = 0;
  56.          while(_loc2_ < pages.length)
  57.          {
  58.             pages[_loc2_].visible = false;
  59.             _loc2_++;
  60.          }
  61.          switch(param1)
  62.          {
  63.             case 1:
  64.                character_mc.visible = true;
  65.                break;
  66.             case 2:
  67.                shirt_mc.visible = true;
  68.                break;
  69.             case 3:
  70.                board_mc.visible = true;
  71.                break;
  72.             case 4:
  73.                course_mc.visible = true;
  74.                break;
  75.             case 5:
  76.                scope.setScreen(3);
  77.          }
  78.       }
  79.       
  80.       private function nextDeck(param1:MouseEvent) : *
  81.       {
  82.          if(board_mc.boardbox.deck.currentFrame < board_mc.boardbox.deck.totalFrames)
  83.          {
  84.             board_mc.boardbox.deck.nextFrame();
  85.          }
  86.          else
  87.          {
  88.             board_mc.boardbox.deck.gotoAndStop(1);
  89.          }
  90.       }
  91.       
  92.       private function selectCourse(param1:MouseEvent) : *
  93.       {
  94.          scope.course = course_mc.coursebox.currentFrame;
  95.          if(scope["c" + course_mc.coursebox.currentFrame + "lock"])
  96.          {
  97.             locked();
  98.          }
  99.          else
  100.          {
  101.             pageManager(5);
  102.          }
  103.       }
  104.       
  105.       private function onRemove(param1:Event) : *
  106.       {
  107.          character_mc.nextCharBtn.removeEventListener(MouseEvent.CLICK,nextChar);
  108.          character_mc.selectCharBtn.removeEventListener(MouseEvent.CLICK,selectChar);
  109.          shirt_mc.nextShirtBtn.removeEventListener(MouseEvent.CLICK,nextShirt);
  110.          shirt_mc.selectShirtBtn.removeEventListener(MouseEvent.CLICK,selectShirt);
  111.          board_mc.nextDeckBtn.removeEventListener(MouseEvent.CLICK,nextDeck);
  112.          board_mc.nextWheelBtn.removeEventListener(MouseEvent.CLICK,nextWheel);
  113.          board_mc.selectBoardBtn.removeEventListener(MouseEvent.CLICK,selectBoard);
  114.          course_mc.nextCourseBtn.removeEventListener(MouseEvent.CLICK,nextCourse);
  115.          course_mc.selectCourseBtn.removeEventListener(MouseEvent.CLICK,selectCourse);
  116.          removeEventListener(Event.REMOVED_FROM_STAGE,onRemove);
  117.       }
  118.       
  119.       private function selectShirt(param1:MouseEvent) : *
  120.       {
  121.          scope.player.snum = shirt_mc.shirtbox.currentFrame;
  122.          pageManager(3);
  123.       }
  124.       
  125.       private function selectBoard(param1:MouseEvent) : *
  126.       {
  127.          scope.player.dnum = board_mc.boardbox.deck.currentFrame;
  128.          scope.player.wnum = board_mc.boardbox.wheels.currentFrame;
  129.          pageManager(4);
  130.       }
  131.       
  132.       private function nextWheel(param1:MouseEvent) : *
  133.       {
  134.          if(board_mc.boardbox.wheels.currentFrame < board_mc.boardbox.wheels.totalFrames)
  135.          {
  136.             board_mc.boardbox.wheels.nextFrame();
  137.          }
  138.          else
  139.          {
  140.             board_mc.boardbox.wheels.gotoAndStop(1);
  141.          }
  142.       }
  143.       
  144.       private function selectChar(param1:MouseEvent) : *
  145.       {
  146.          scope.player.cnum = character_mc.charbox.currentFrame;
  147.          pageManager(2);
  148.       }
  149.       
  150.       private function nextShirt(param1:MouseEvent) : *
  151.       {
  152.          if(shirt_mc.shirtbox.currentFrame < shirt_mc.shirtbox.totalFrames)
  153.          {
  154.             shirt_mc.shirtbox.nextFrame();
  155.          }
  156.          else
  157.          {
  158.             shirt_mc.shirtbox.gotoAndStop(1);
  159.          }
  160.       }
  161.       
  162.       private function nextChar(param1:MouseEvent) : *
  163.       {
  164.          if(character_mc.charbox.currentFrame < character_mc.charbox.totalFrames)
  165.          {
  166.             character_mc.charbox.nextFrame();
  167.          }
  168.          else
  169.          {
  170.             character_mc.charbox.gotoAndStop(1);
  171.          }
  172.       }
  173.       
  174.       private function nextCourse(param1:MouseEvent) : *
  175.       {
  176.          if(course_mc.coursebox.currentFrame < course_mc.coursebox.totalFrames)
  177.          {
  178.             course_mc.coursebox.nextFrame();
  179.          }
  180.          else
  181.          {
  182.             course_mc.coursebox.gotoAndStop(1);
  183.          }
  184.          if(scope["c" + course_mc.coursebox.currentFrame + "lock"])
  185.          {
  186.             course_mc.coursebox.locked_mc.visible = true;
  187.          }
  188.          else
  189.          {
  190.             course_mc.coursebox.locked_mc.visible = false;
  191.          }
  192.       }
  193.    }
  194. }
  195.